﻿<Window x:Class="Pit.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
				xmlns:sys="clr-namespace:System;assembly=mscorlib"
        Title="MainWindow" 
				Width="1280" Height="760" 
				Loaded="Window_Loaded"
				Closing="Window_Closing"
				KeyDown="Window_KeyDown"
				WindowState="Maximized"
				WindowStyle="None"
				Topmost="False"
				FontSize="22">
	<Grid Margin="10">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="Auto"/>
			<ColumnDefinition/>
			<ColumnDefinition Width="Auto"/>
			<ColumnDefinition Width="Auto"/>
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>

		<TextBlock x:Name="textInfo"
							 Grid.Row="3"
							 Grid.ColumnSpan="4"
							 VerticalAlignment="Bottom"/>
		<!--Pist-->
		<StackPanel Grid.RowSpan="3">
			<TextBlock x:Name="textLap" Text="0/50"
								 FontSize="40"
								 HorizontalAlignment="Center"/>
			<Canvas x:Name="myCircuit"
							Width="445" Height="640">
				<StackPanel Canvas.Bottom="25"
										Canvas.Left="30">
					<TextBlock x:Name="textGPS"/>
					<TextBlock x:Name="textAltitude"/>
				</StackPanel>
				<!--<Canvas.Background>
					<ImageBrush ImageSource="Images\Pinarbasi.png"/>
				</Canvas.Background>-->
				<Image Width="445" Height="640">
					<Image.Source>
						<DrawingImage>
							<DrawingImage.Drawing>
								<DrawingGroup>

									<GeometryDrawing>
										<GeometryDrawing.Pen>
											<Pen Brush="Gray" Thickness="1"/>
										</GeometryDrawing.Pen>
										<GeometryDrawing.Geometry>
											<GeometryGroup>
												<RectangleGeometry Rect="0,0,445,640"/>
											</GeometryGroup>
										</GeometryDrawing.Geometry>
									</GeometryDrawing>

									<!--<GeometryDrawing Geometry="
																	 M 335,447
																	 C 305,465 265,495 252,515">
										<GeometryDrawing.Pen>
											<Pen Brush="Gray" Thickness="5"/>
										</GeometryDrawing.Pen>
									</GeometryDrawing>-->

									<GeometryDrawing xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
																	 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
																	 Geometry="
																	 M 73,462
																	 L 24,82
																	 C 10,0 90,0 107,30
																	 L 218,360
																	 C 230,380 290,380 283,330
																	 L 241,200
																	 C 235,152 250,145 316,150
																	 C 328,155 350,165 355,190
																	 L 432,360
																	 C 433,396 445,435 400,440
																	 C 358,437 360,436 335,447
																	 L 150,520
																	 C 110,535 80,492 73,461">
										<GeometryDrawing.Pen>
											<Pen Brush="Black"
													 Thickness="5"
													 LineJoin="Round"/>
										</GeometryDrawing.Pen>
									</GeometryDrawing>

								</DrawingGroup>
							</DrawingImage.Drawing>
						</DrawingImage>
					</Image.Source>
				</Image>

				<Ellipse x:Name="mySolarCarOnMap"
								 Canvas.Bottom="0"
								 Canvas.Left="0"
								 Width="15" Height="15"
								 Fill="Red"/>
			</Canvas>
			<!--<StackPanel Orientation="Horizontal">
				<StackPanel>
					<TextBlock Text="Enlem "/>
					<TextBlock Text="Boylam "/>
				</StackPanel>
				<StackPanel>
					<TextBlock x:Name="textGPS_Latitude"	Text=": "/>
					<TextBlock x:Name="textGPS_Longitude" Text=": "/>
				</StackPanel>
			</StackPanel>-->
		</StackPanel>

		<!--Sure-->
		<Label x:Name="textTime"
					 Grid.ColumnSpan="3"
					 Grid.Row="0"
					 VerticalAlignment="Top"
					 HorizontalAlignment="Center"
					 FontSize="40"
					 Margin="90,0,0,0"
					 FontWeight="Bold">
			<sys:TimeSpan>0:00:00</sys:TimeSpan>
		</Label>
		<Ellipse x:Name="myConnectionStatus"
						 Grid.Column="0"
						 VerticalAlignment="Top"
						 HorizontalAlignment="Left"
						 Margin="10,5"
						 Fill="Red"
						 Width="40"
						 Height="40"/>

		<StackPanel Grid.Column="1"
								Grid.Row="1"
								Grid.ColumnSpan="2"
								Margin="10"
								Orientation="Horizontal"
								VerticalAlignment="Bottom"
								HorizontalAlignment="Right">
			<StackPanel>
				<TextBlock Text="Atabileceği Tur "/>
				<TextBlock Text="En Hızlı Tur "/>
				<TextBlock Text="En Yavaş Tur "/>
			</StackPanel>
			<StackPanel>
				<TextBlock x:Name="textAtabilecegiTur" Text=": 7"/>
				<TextBlock Text=": 5:02.142"/>
				<TextBlock Text=": 6:14.286"/>
			</StackPanel>
		</StackPanel>

		<StackPanel Grid.Column="1"
								Grid.Row="0"
								Grid.RowSpan="2"
								Width="Auto"
								HorizontalAlignment="Left"
								VerticalAlignment="Bottom"
								Orientation="Horizontal"
								ProgressBar.ValueChanged="ProgressBars_ValueChanged">
			<StackPanel.Resources>
				<Style TargetType="{x:Type ProgressBar}">
					<Setter Property="Orientation" Value="Vertical"/>
					<Setter Property="Width" Value="50"/>
					<Setter Property="Height" Value="200"/>
					<Setter Property="Margin" Value="0,10"/>
					<Setter Property="BorderThickness" Value="4"/>
				</Style>
				<Style TargetType="{x:Type StackPanel}">
					<Setter Property="Width" Value="90"/>
				</Style>
				<Style TargetType="{x:Type TextBlock}">
					<Setter Property="HorizontalAlignment" Value="Center"/>
				</Style>
				<Style TargetType="{x:Type Image}">
					<Setter Property="Width" Value="50"/>
					<Setter Property="Height" Value="50"/>
				</Style>
			</StackPanel.Resources>
			<StackPanel>
				<Image Source="Images\Battery.png"/>
				<StackPanel Orientation="Horizontal">
					<TextBlock Text="Akü Şarj Durumu"
										 VerticalAlignment="Center">
					<TextBlock.LayoutTransform>
						<RotateTransform Angle="-90"/>
					</TextBlock.LayoutTransform>
					</TextBlock>
					<ProgressBar x:Name="progressBatterySOC"
											 Minimum="0"
											 Maximum="100"/>
				</StackPanel>
				<TextBlock Text="{Binding ElementName=progressBatterySOC, Path=Value, StringFormat={}%{0:#0.00}}"
									 Margin="10"/>
			</StackPanel>

			<StackPanel>
				<Image Source="Images\Temperature.gif"/>
				<StackPanel Orientation="Horizontal">
					<TextBlock Text="Akü Sıcaklığı"
										 VerticalAlignment="Center">
					<TextBlock.LayoutTransform>
						<RotateTransform Angle="-90"/>
					</TextBlock.LayoutTransform>
					</TextBlock>
					<ProgressBar x:Name="progressBatteryTemperature"
											 Minimum="0"
											 Maximum="80"/>
				</StackPanel>
				<TextBlock Text="{Binding ElementName=progressBatteryTemperature, Path=Value, StringFormat={}{0:#0.0}°}"
									 Margin="10"/>
			</StackPanel>

			<GroupBox>
				<GroupBox.Header>
					<StackPanel Orientation="Horizontal" Width="Auto">
						<Image Source="Images\BatteryCar.png"/>
						<TextBlock Text="Akü"
											 Margin="10"
											 VerticalAlignment="Center"/>
					</StackPanel>
				</GroupBox.Header>
				<StackPanel Orientation="Horizontal"
										Width="Auto">
					
					<StackPanel>
						<TextBlock Text="V"
											 HorizontalAlignment="Center"/>
						<ProgressBar x:Name="progressBatteryVoltage"
												 Maximum="80"
												 Value="0" Height="170"/>
						<TextBlock Text="{Binding ElementName=progressBatteryVoltage, Path=Value,StringFormat={}{0:#0.0}}"
											 Margin="10"/>
					</StackPanel>

					<StackPanel>
						<TextBlock Text="A"
											 HorizontalAlignment="Center"/>
						<ProgressBar x:Name="progressBatteryCurrent"
												 Maximum="60" Margin="0,10,0,0"
												 Foreground="Red"
												 Value="0" Height="85"
												 BorderThickness="0,5,5,5"/>
						<ProgressBar x:Name="progressBatteryCurrentNegative"
												 Minimum="0"
												 Maximum="60" Margin="0,0,0,10"
												 Value="0" Height="85"
												 BorderThickness="0,5,5,5">
							<ProgressBar.LayoutTransform>
								<RotateTransform Angle="180"/>
							</ProgressBar.LayoutTransform>
						</ProgressBar>
						<TextBlock x:Name="textBatteryCurrent"
											 Margin="10"
											 Text="0.0"/>
						<!--Text="{Binding ElementName=progressBatteryCurrent, Path=Value, StringFormat={}{0:#0.0}}"-->
					</StackPanel>
				</StackPanel>
			</GroupBox>
		</StackPanel>
		<!--Cubuk Gostergeler-->
		<StackPanel Grid.Column="1"
								Grid.Row="2"
								Grid.ColumnSpan="2"
								Width="Auto"
								HorizontalAlignment="Left"
								VerticalAlignment="Bottom"
								Orientation="Horizontal"
								ProgressBar.ValueChanged="ProgressBars_ValueChanged">

			<StackPanel.Resources>
				<Style TargetType="{x:Type ProgressBar}">
					<Setter Property="Orientation" Value="Vertical"/>
					<Setter Property="Width" Value="50"/>
					<Setter Property="Height" Value="200"/>
					<Setter Property="Margin" Value="0,10"/>
					<Setter Property="BorderThickness" Value="4"/>
				</Style>
				<Style TargetType="{x:Type StackPanel}">
					<Setter Property="Width" Value="90"/>
				</Style>
				<Style TargetType="{x:Type TextBlock}">
					<Setter Property="HorizontalAlignment" Value="Center"/>
				</Style>
				<Style TargetType="{x:Type Image}">
					<Setter Property="Width" Value="50"/>
					<Setter Property="Height" Value="50"/>
				</Style>
			</StackPanel.Resources>

			<StackPanel>
				<Image Source="Images\Temperature.gif"/>
				<StackPanel Orientation="Horizontal">
					<TextBlock Text="Panel Sıcaklığı 1"
										 VerticalAlignment="Center">
					<TextBlock.LayoutTransform>
						<RotateTransform Angle="-90"/>
					</TextBlock.LayoutTransform>
					</TextBlock>
					<ProgressBar x:Name="progressPVTemperature1"
											 Minimum="0"
											 Maximum="80"/>
				</StackPanel>
				<TextBlock Text="{Binding ElementName=progressPVTemperature1, Path=Value, StringFormat={}{0:#0.0}°}"
									 Margin="10"/>
			</StackPanel>

			<StackPanel>
				<Image Source="Images\Temperature.gif"/>
				<StackPanel Orientation="Horizontal">
					<TextBlock Text="Panel Sıcaklığı 2"
										 VerticalAlignment="Center">
					<TextBlock.LayoutTransform>
						<RotateTransform Angle="-90"/>
					</TextBlock.LayoutTransform>
					</TextBlock>
					<ProgressBar x:Name="progressPVTemperature2"
											 Minimum="0"
											 Maximum="80"/>
				</StackPanel>
				<TextBlock Text="{Binding ElementName=progressPVTemperature2, Path=Value, StringFormat={}{0:#0.0}°}"
									 Margin="10"/>
			</StackPanel>

			<StackPanel>
				<Image Source="Images\Temperature.gif"/>
				<StackPanel Orientation="Horizontal">
					<TextBlock Text="Panel Sıcaklığı 3"
										 VerticalAlignment="Center">
					<TextBlock.LayoutTransform>
						<RotateTransform Angle="-90"/>
					</TextBlock.LayoutTransform>
					</TextBlock>
					<ProgressBar x:Name="progressPVTemperature3"
											 Minimum="0"
											 Maximum="80"/>
				</StackPanel>
				<TextBlock Text="{Binding ElementName=progressPVTemperature3, Path=Value, StringFormat={}{0:#0.0}°}"
									 Margin="10"/>
			</StackPanel>

			<GroupBox>
				<GroupBox.Header>
					<StackPanel Orientation="Horizontal" Width="Auto">
						<Image Source="Images\Sun.png"/>
						<TextBlock Text="PV 1"
											 VerticalAlignment="Center"
											 Margin="10"/>
					</StackPanel>
				</GroupBox.Header>
				<StackPanel Orientation="Horizontal"
										Width="Auto">
					<StackPanel>
						<TextBlock Text="V"
											 HorizontalAlignment="Center"/>
						<ProgressBar x:Name="progressPV_Voltage1"
												 Minimum="0"
												 Maximum="80"
												 Value="0" Height="170"/>
						<TextBlock Text="{Binding ElementName=progressPV_Voltage1, Path=Value, StringFormat={}{0:#0.0}}"
									 Margin="10"/>
					</StackPanel>

					<StackPanel>
						<TextBlock Text="A"
											 HorizontalAlignment="Center"/>
						<ProgressBar x:Name="progressPV_Current1"
												 Maximum="200"
												 Value="0" Height="170"/>
						<TextBlock Text="{Binding ElementName=progressPV_Current1, Path=Value, StringFormat={}{0:#0.0}}"
									 Margin="10"/>
					</StackPanel>
				</StackPanel>
			</GroupBox>

			<GroupBox>
				<GroupBox.Header>
					<StackPanel Orientation="Horizontal" Width="Auto">
						<Image Source="Images\Sun.png"/>
						<TextBlock Text="PV 2"
											 VerticalAlignment="Center"
											 Margin="10"/>
					</StackPanel>
				</GroupBox.Header>
				<StackPanel Orientation="Horizontal"
										Width="Auto">
					<StackPanel>
						<TextBlock Text="V"
											 HorizontalAlignment="Center"/>
						<ProgressBar x:Name="progressPV_Voltage2"
												 Minimum="0"
												 Maximum="80"
												 Value="0" Height="170"/>
						<TextBlock Text="{Binding ElementName=progressPV_Voltage2, Path=Value, StringFormat={}{0:#0.0}}"
									 Margin="10"/>
					</StackPanel>

					<StackPanel>
						<TextBlock Text="A"
											 HorizontalAlignment="Center"/>
						<ProgressBar x:Name="progressPV_Current2"
												 Maximum="60"
												 Value="0" Height="170"/>
						<TextBlock Text="{Binding ElementName=progressPV_Current2, Path=Value, StringFormat={}{0:#0.0}}"
									 Margin="10"/>
					</StackPanel>
				</StackPanel>
			</GroupBox>

		</StackPanel>

		<!--Tur Bilgileri-->
		<StackPanel Grid.Column="2"
								Grid.Row="0"
								Grid.RowSpan="1"
								Orientation="Horizontal"
								HorizontalAlignment="Right">
			<GroupBox Header="Tur Zamanları">
				<ListBox ScrollViewer.VerticalScrollBarVisibility="Visible">
					<ListBoxItem Content="5:24.990"/>
					<ListBoxItem Content="6:03.783"/>
					<ListBoxItem Content="5:59.876"/>
					<ListBoxItem Content="5:44.138"/>
					<ListBoxItem Content="6:13.674"/>
				</ListBox>
			</GroupBox>
		</StackPanel>

		<StackPanel Grid.Column="3"
								Grid.RowSpan="4">
			<StackPanel.Resources>
				<Style TargetType="{x:Type ProgressBar}">
					<Setter Property="Orientation" Value="Vertical"/>
					<Setter Property="Width" Value="50"/>
					<Setter Property="Height" Value="200"/>
					<Setter Property="Margin" Value="0,10"/>
					<Setter Property="BorderThickness" Value="4"/>
				</Style>
			</StackPanel.Resources>
			<Image Source="Images\Speedometer.png"
						 HorizontalAlignment="Right"/>
			<StackPanel Orientation="Horizontal">
				<TextBlock Text="Hız"
										 VerticalAlignment="Center">
					<TextBlock.LayoutTransform>
						<RotateTransform Angle="-90"/>
					</TextBlock.LayoutTransform>
				</TextBlock>
				<ProgressBar x:Name="progressSpeed"
										 Margin="0,20,0,0"
										 Width="80"
										 Height="620"
										 Minimum="0"
										 Maximum="100"/>
			</StackPanel>
			<TextBlock Text="{Binding ElementName=progressSpeed, Path=Value, StringFormat={}{0:#0}}"
								 HorizontalAlignment="Right"
								 FontSize="50"
								 FontWeight="Bold"
								 Margin="10"/>
		</StackPanel>
	</Grid>
</Window>
